#include<bits/stdc++.h> 
using namespace std;
int main(){
    int count=0;
for(int i=1;i<=20000;i++){
    int pd=0 ;
    for(int j=2;j<sqrt(i);j++){
        if(i%j==0){
            pd=1;
            break;
        }
    }
    if(pd==0){
        cout<<i<<" ";
        if(count%5==0&&count!=0)cout<<endl;
        count++;
    }
    
 }
}
